﻿<Window x:Class="WetHatLab.OneNote.TaggingKit.manage.TagManager"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:cui="clr-namespace:WetHatLab.OneNote.TaggingKit.common.ui"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:local="clr-namespace:WetHatLab.OneNote.TaggingKit.manage"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:prop="clr-namespace:WetHatLab.OneNote.TaggingKit.Properties"
        Title="{Binding Mode=OneTime,
                        Source={x:Static prop:Resources.TagManager_Window_Title}}"
        Width="{Binding Source={x:Static prop:Settings.Default},
                        Path=TagManagerWindow_Width,
                        Mode=TwoWay}"
        Height="{Binding Source={x:Static prop:Settings.Default},
                         Path=TagManagerWindow_Height,
                         Mode=TwoWay}"
        MinWidth="350"
        MinHeight="250"
        Closing="Window_Closing"
        Icon="/OneNoteTaggingKit;component/Resources/tag 64x64.png"
        Loaded="Window_Loaded"
        WindowStartupLocation="CenterOwner"
        WindowStyle="ToolWindow"
        d:DataContext="{d:DesignInstance IsDesignTimeCreatable=True,
                                         Type={x:Type local:TagManagerDesignerModel}}"
        mc:Ignorable="d">
    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="pack://application:,,,/OneNoteTaggingKit;component/Resources/Styles.xaml" />
                <ResourceDictionary>
                    <ContextMenu x:Key="contextMenu">
                        <MenuItem Click="Copy_MenuItem_Click" Header="{Binding Mode=OneTime, Source={x:Static prop:Resources.TagManager_ContextMenu_Copy}}">
                            <MenuItem.Icon>
                                <Image Source="/OneNoteTaggingKit;component/Resources/copy-26.png" />
                            </MenuItem.Icon>
                        </MenuItem>
                    </ContextMenu>
                </ResourceDictionary>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Window.Resources>

    <Window.Background>
        <LinearGradientBrush MappingMode="RelativeToBoundingBox" StartPoint="0.5,0" EndPoint="0.5,1">
            <GradientStop Offset="0.497" Color="Ivory" />
            <GradientStop Offset="1" Color="#FFF3DEF2" />
        </LinearGradientBrush>
    </Window.Background>
    <TabControl Grid.Row="0" Background="Transparent">
        <TabItem BorderThickness="0"
                 Header="{Binding Mode=OneTime,
                                  Source={x:Static prop:Resources.TagManager_TagSuggestionsTab_Header}}"
                 IsSelected="True"
                 ToolTip="{Binding Mode=OneTime,
                                   Source={x:Static prop:Resources.TagManager_TagSuggestionsTab_Tooltip}}">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                <cui:TagInputBox x:Name="tagInput"
                                 Grid.Row="0"
                                 Grid.Column="0"
                                 Margin="5,5,10,5"
                                 VerticalAlignment="Center"
                                 TagInput="TagInputBox_Input"
                                 ToolTip="{Binding Mode=OneTime,
                                                   Source={x:Static prop:Resources.TagManager_NewTagTextbox_Tooltip}}" />
                <StackPanel Grid.Row="0"
                            Grid.Column="2"
                            Orientation="Horizontal">
                    <Button x:Name="newTagButton"
                            Width="26"
                            Height="26"
                            Margin="0,0,5,0"
                            Click="NewTagButton_Click"
                            Style="{StaticResource controlEffectStyle}"
                            ToolTip="{Binding Mode=OneTime,
                                              Source={x:Static prop:Resources.TagManager_NewTagButton_Tooltip}}">
                        <Button.Background>
                            <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                                <GradientStop Offset="0" Color="#FF00FF00" />
                                <GradientStop Offset="1" Color="#FFB0ADAD" />
                            </LinearGradientBrush>
                        </Button.Background>
                        <TextBlock VerticalAlignment="Center"
                                   FontFamily="Segoe UI Symbol"
                                   FontSize="22"
                                   FontWeight="ExtraBold"
                                   Text="✙"
                                   TextAlignment="Center" />
                    </Button>
                    <Button Width="26"
                            Height="26"
                            Click="SaveButton_Click"
                            Style="{DynamicResource controlEffectStyle}"
                            ToolTip="{Binding Mode=OneTime,
                                              Source={x:Static prop:Resources.TagManager_SaveTagsButton_Tooltip}}">
                        <Image Source="/OneNoteTaggingKit;component/Resources/save-26.png" />
                    </Button>
                </StackPanel>
                <cui:HighlightedTagsPanel x:Name="suggestedTags"
                                          Grid.Row="1"
                                          Grid.Column="0"
                                          Grid.ColumnSpan="2"
                                          ContextMenu="{StaticResource contextMenu}"
                                          Header="{Binding Mode=OneTime,
                                                           Source={x:Static prop:Resources.TagManager_SuggestedTags_Header}}"
                                          TagSource="{Binding SuggestedTags}">
                    <cui:HighlightedTagsPanel.TagTemplate>
                        <DataTemplate>
                            <local:RemovableTag Margin="0,5,5,0" Click="TagButton_Click" />
                        </DataTemplate>
                    </cui:HighlightedTagsPanel.TagTemplate>
                </cui:HighlightedTagsPanel>
                <ProgressBar Name="pBar"
                             Grid.Row="1"
                             Grid.Column="0"
                             Grid.ColumnSpan="2"
                             Visibility="Visible" />
            </Grid>
        </TabItem>
        <TabItem Header="{Binding Mode=OneTime, Source={x:Static prop:Resources.TagManager_AboutTab_Header}}">
            <RichTextBox Margin="5,5,5,0"
                         Background="Transparent"
                         BorderThickness="0"
                         IsDocumentEnabled="True"
                         IsReadOnly="True">
                <FlowDocument>
                    <Paragraph>
                        <Image Height="32"
                               HorizontalAlignment="Left"
                               VerticalAlignment="Top"
                               Source="/OneNoteTaggingKit;component/Resources/tag 32x32.png" />
                        <Run BaselineAlignment="Center"
                             FontSize="16"
                             FontWeight="Bold"
                             Foreground="LightSeaGreen"
                             Text="{Binding Mode=OneTime,
                                            Source={x:Static prop:Resources.TaggingKit_About_Appname}}" />
                        <Run BaselineAlignment="Center" Text="{Binding AddinVersion, Mode=OneTime}" />
                    </Paragraph>
                    <Paragraph>
                        <Run FontWeight="Bold" Text="{Binding Mode=OneTime, Source={x:Static prop:Resources.TaggingKit_About_Description}}" />
                    </Paragraph>
                    <Paragraph>
                        <Run Text="{Binding Mode=OneTime, Source={x:Static prop:Resources.TaggingKit_About_Copyright}}" />
                    </Paragraph>
                    <Paragraph>
                        <Run Text="{Binding Mode=OneTime, Source={x:Static prop:Resources.TaggingKit_About_Framework}}" />
                        <Run BaselineAlignment="Center" Text="{Binding FrameworkVersion, Mode=OneTime}" />
                    </Paragraph>
                    <Paragraph>
                        <Run Text="{Binding Mode=OneTime, Source={x:Static prop:Resources.TaggingKit_About_Website}}" />
                        <Hyperlink NavigateUri="{Binding Mode=OneTime, Source={x:Static prop:Resources.TaggingKit_About_AddIn_Website}}" RequestNavigate="Hyperlink_RequestNavigate">
                            <Run Text="{Binding Mode=OneTime, Source={x:Static prop:Resources.TaggingKit_About_AddIn_Website}}" />
                        </Hyperlink>
                    </Paragraph>
                    <Paragraph>
                        <Run Text="{Binding Mode=OneTime, Source={x:Static prop:Resources.TaggingKit_About_Logfile}}" />
                        <Hyperlink NavigateUri="{Binding Logfile}" RequestNavigate="Hyperlink_RequestLogNavigate">
                            <Run Text="{Binding Logfile, Mode=OneTime}" />
                        </Hyperlink>
                    </Paragraph>
                </FlowDocument>
            </RichTextBox>
        </TabItem>
    </TabControl>
</Window>
